<meta charset="utf-8">
<?php
require_once("tools.php");

$con = new con_db();

$psd = md5($_POST["psd"]);

$sql = "INSERT INTO persons (zhanghao, mima, email,bkc)
  		VALUES ('$_POST[id]','$psd','$_POST[email]',2)";
$con->query($sql);
if (!$con)
  {
  die(mysql_error());
  }
echo "<script>alert('注册成功');window.location.href='homepage.php';</script>";

setcookie('user', $_POST['id'], time() + 3600);
setcookie("bkgcolordone", '2', time() + 3600);
setcookie("bkgcolor", '2', time() + 3600);
setcookie("admin", '0', time() + 3600);
?>